from typing import List


def quick_sort(nums: List, left: int, right: int):
    if left >= right:
        return
    i, j = left, right
    key = nums[left]

    while left <= right:
        while i < j and nums[j] >= key:
            j -= 1
        if i < j:
            nums[i] = nums[j]
            i += 1
        while i < j and nums[i] < key:
            i += 1
        if i < j:
            nums[j] = nums[i]
            j -= 1
    nums[i] = key
    quick_sort(nums, left, i - 1)
    quick_sort(nums, i + 1, right)


if __name__ == '__main__':
    x = quick_sort([3,2,1], 0, 2)
    print(x)
